//
// Created by baigui on 21-7-2.
//

#ifndef SIMPLE_PLAYER_MODULE_MANAGER_CPP
#define SIMPLE_PLAYER_MODULE_MANAGER_CPP

#include "VideoRender.h"
#include "NDKDemux.h"
#include "moduleFactory.h"

class Module
{
public:
    ~Module(){
    }

    ModuleManager<Demux> demuxModuleManager;
    ModuleManager<VideoDecoder> decoderModuleManager;
    ModuleManager<VideoRender> renderModuleManager;

    Module(const Module&)=delete;

    Module& operator=(const Module&)=delete;

    static Module& get_instance(){
        static Module instance;
        return instance;
    }

private:
    Module(){

        FactortyNode<Demux> *tsDemuxFactory = new TsDemuxFactory();
        demuxModuleManager.registerFactory(tsDemuxFactory);

        FactortyNode<Demux> *mkvDemuxFactory = new MKVDemuxFactory();
        demuxModuleManager.registerFactory(mkvDemuxFactory);

        FactortyNode<Demux> *ffmpegDemuxFactory = new FFMPEGDemuxFactory();
        demuxModuleManager.registerFactory(ffmpegDemuxFactory);

        FactortyNode<Demux> *ndkDemuxFactory = new NdkDemuxFactory();
        demuxModuleManager.registerFactory(ndkDemuxFactory);


        FactortyNode<VideoDecoder> *ndkDecoderFactory = new NdkDecoderFactory();
        decoderModuleManager.registerFactory(ndkDecoderFactory);

        FactortyNode<VideoRender> *ndkrenderFactory = new NdkRenderFactory();
        renderModuleManager.registerFactory(ndkrenderFactory);

        LOGV("init module end");
    }
};



#endif //SIMPLE_PLAYER_MODULE_MANAGER_CPP
